{% extends "./inc/appbase.html" %}
{%block style%}
<style>
    .original {
        border: 1px solid #999;
        font-size: 10px !important;
        border-radius: 4px;
        line-height: 14px;
        width: 30px;
        color: #505050;
        text-align: center;
        margin-right: 5px;

        position: relative;
        padding: 0 2px;
    }
    .price {
        color: #e4393c;
    }
    .losspayer {
        color: #007fff;
    }
    .mui-table h4 ,.mui-media-body h4{
        font-size: 15px;
        margin: 0;
        font-weight: 300;
    }
    .mui-bar-nav ~ .mui-content .mui-pull-top-pocket{
        top: 0px !important;
    }
</style>
{%endblock%}
{% block content %}
<header class="mui-bar mui-bar-nav">
    <a  href="/center/club" class="mui-icon mui-icon-left-nav mui-pull-left"></a>
    <h1 class="mui-title">{{controller.meta_title}}</h1>
    <!--  
    <a href="/center/club/account/?clubid={{club_id}}&opt=-1" class="mui-btn mui-btn-blue mui-btn-link mui-pull-right delclub" >解散俱乐部</a>
    -->
</header>

<div class="mui-content">
    <div class="mui-card">
    <ul class="mui-table-view ">
        <li class="mui-table-view-cell">
        <div class="mui-content-padded" >
        <p class="text-center" style="color:black;">俱乐部剩余房卡:{{cardNum}}</p>
        </div>
        </li>
        <li class="mui-table-view-cell  mui-center mui-media mui-media-icon">
              <div class="mui-button-row">
						<button type="button" class="mui-btn mui-btn-primary" id="rechange">转入</button>&nbsp;&nbsp;
			  </div>
        </li>
    </ul>
    </div>
    
    <div class="mui-card">
    <ul class="mui-table-view ">
        <li class="mui-table-view-cell">
        <div class="mui-content-padded" >
        {% if dailyCard and warnCard %}
        <p class="text-center" style="color:black;">每位成员最多可消耗{{dailyCard}}张/天</p>
        <p class="text-center" style="color:black;">俱乐部房卡低于{{warnCard}}张时提醒</p>
        {%else%}
        <p class="text-center" style="color:black;">每位成员最多可消耗数量未设置</p>
        <p class="text-center" style="color:black;">俱乐部房卡过低提醒数量未设置</p>
        {%endif%}
        </div>
        </li>
        <li class="mui-table-view-cell  mui-center mui-media mui-media-icon">
              <div class="mui-button-row">
						<button type="button" class="mui-btn mui-btn-primary" id="setting">设置</button>&nbsp;&nbsp;
			  </div>
        </li>
    </ul>
    </div>
    
    <div class="mui-card">
    <ul class="mui-table-view ">
        <li class="mui-table-view-cell">
        <div class="mui-content-padded" >
        <p class="text-center" style="color:black;">俱乐部[ {{name}} ]</p>
        <p class="text-center" style="color:black;">向您发出入会邀请</p>
        <p class="text-center" style="color:black;">俱乐部ID: {{club_id}} [下载地址]</p>
        <p class="text-center" style="color:black;">http://www.hongshihuyu.com/club/yaoqing/?id={{club_id}}</p>
        <p class="text-center" style="color:black;">复制此信息打开游戏可直接申请加入</p>
        </div>
        </li>
        <li class="mui-table-view-cell  mui-center mui-media mui-media-icon">
             <div class="mui-button-row">
				<button type="button" class="mui-btn mui-btn-primary" id="copy">复制转发</button>&nbsp;&nbsp;
			  </div>
        </li>
    </ul>
    </div>
</div>


{% endblock%}

{% block script %}
<script>
    mui.init();
    

    mui.ready(function() {

        //解散俱乐部
        /**
        mui("header").on('tap','.delclub',function(){
        	mui.toast("功能开发中。。。")
            return
            
        	var self = this;
            var btnArray = ['否', '是'];
            mui.confirm('是否确认解散俱乐部？', '', btnArray, function(e) {
                if (e.index == 1) {
                    //获取id
                    var id = self.getAttribute("href");
                    mui.post(id,function(data){
                    	   if(data.errno==0){
                                mui.toast(data.data.name);
                                setTimeout(function() {
                                  location.reload();
                                }, 1500);
                            }else {
                                mui.toast(data.error);
                            }
                       },'json'
                    );
                }
            })
            
        })
        */
        
        mui("header").on('tap','.mui-pull-left',function(){
            var id = this.getAttribute("href");
            console.log('url---:'+id);
            mui.openWindow({
                url: id,
            });
            return;
        })
        
       //成员管理、俱乐部账户、战绩查询
         mui(document).on('tap','a.club',function(){
        	 var href = this.getAttribute("href");
             mui.openWindow({
                 url:href,
             });
             return;
         })
         
         
         mui(document).on('tap','#setting',function(){
     	    //mui.toast("功能开发中。。。")
              //return
        	 var href = '/center/club/setting/?id={{club_id}}';
             mui.openWindow({
                 url:href,
             });
             return;
         })
       
         mui(document).on('tap','#copy',function(){
        	    /**
        	    mui.toast("功能开发中。。。")
                 return
                */
                var self = this;
                var message = 'http://www.hongshihuyu.com/club/yaoqing/?id={{club_id}}';
                var input = document.createElement("input");
                input.value = message;
                document.body.appendChild(input);
                input.select();
                input.setSelectionRange(0, input.value.length), document.execCommand('Copy');
                document.body.removeChild(input);
                mui.toast("复制下载地址  "+message+" 到剪贴板成功!");
                return false;
          })
          
          //转入房卡
         mui(document).on('tap','#rechange',function(){
             var self = this;
             var card_count = "{{card_count}}"
             var btnArray = ['取消', '确定'];
             mui.prompt('您当前房卡:'+card_count+'张', '请输入转入房卡数', '转入', btnArray, function(e) {
                 if (e.index == 1) {
                	 if(e.value===''){
                         mui.toast("请输入转入房卡数！");
                     }else{
                    	 console.log('转入房卡数------:'+e.value);
                    	 //  /center/club/rename/?clubid={{item.id}}
                    	 var href = '/center/club/rechange/?club_id={{club_id}}';
                         mui.post(href,{card_num:e.value},function(data){
                                     if(data.errno==0){
                                         mui.toast(data.data.name);
                                         //location.reload();
                                         setTimeout('location.reload();', 2000);
                                     }else {
                                         mui.toast(data.error);
                                     }
                                 },'json'
                         );
                    	
                     }
                     //info.innerText = '谢谢你的评语：' + e.value;
                 } else {
                	 console.log('编辑名称------------------2:');
                     //info.innerText = '你点了取消按钮';
                 }
             })
             return false;
         })
         
    });

</script>
{% endblock %}